/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package weixin.popular.message.handler.defaultimpl;

import weixin.popular.bean.message.EventMessage;
import weixin.popular.bean.xmlmessage.XMLMessage;
import weixin.popular.bean.xmlmessage.XMLTextMessage;
import weixin.popular.message.handler.Provider;
import weixin.popular.message.handler.MessageHandler;

/**
 * 被关注消息处理
 * @author 张森
 */
@Provider("subscribeMessageHandler")
public class SubscribeMessageHandler implements MessageHandler {
    
    @Override
    public boolean isSupport(EventMessage message) {
        return message.getMsgType().equals("subscribe");
    }

    @Override
    public XMLMessage reply(EventMessage message) {
        XMLMessage xmlTextMessage = new XMLTextMessage(
                message.getFromUserName(),
                message.getToUserName(),
                "你好，感谢关注");
        return xmlTextMessage;
    }
}
